// gl-scene.props.ts
import { ExtractPropTypes, PropType } from 'vue';
import { createPropsResolver } from '../../dynamic-resolver';
import { schemaMapper } from './schema/schema-mapper';
import glSceneSchema from './schema/gl-scene.schema.json';
import { tr } from 'date-fns/locale';
 /**展示3D模型的组件Props */
 export interface coordinates {
  x: number;
  y: number;
  z: number;
}

export interface controlsValue {
  min: number;
  max: number;
}
type plyMaterial = 'MeshBasicMaterial' | 'MeshStandardMaterial';
type encode = 'linear' | 'sRGB';
export const modelProps = {
  filePath: {
    type: [String, Array],
    required: true,
  },  
  fileType: {
    type: [String, Array],
    default: () => [],
  },
  width: {
    type: Number,
    default: 400,
  },
  height: {
    type: Number,
    default: 400,
  },
  position: {
    type: [Object, Array],
    default: () => [],
  },
  rotation: {
    type: [Object, Array],
    default: () => [],
  },
  scale: {
    type: [Object, Array],
    default: () => [],
  },
  lights: {
    type: Array,
    default: () => [
      {
        type: 'AmbientLight',
        color: 0xaaaaaa,
      },
      {
        type: 'DirectionalLight',
        position: { x: 1, y: 1, z: 1 },
        color: 0xffffff,
        intensity: 0.8,
      },
    ],
  },
  cameraPosition: {
    type: Object,
    default: () => ({ x: 0, y: 0, z: 0 }),
  },
  cameraRotation: {
    type: Object,
    default: () => ({ x: 0, y: 0, z: 0 }),
  },
  cameraUp: {
    type: Object,
    default: () => ({ x: 0, y: 1, z: 0 }),
  },
  cameraLookAt: {
    type: Object,
    default: () => ({ x: 0, y: 0, z: 0 }),
  },
  backgroundColor: {
    type: [Number, String],
    default: () => 0xffffff,
  },
  backgroundAlpha: {
    type: Number,
    default: 1,
  },
  controlsOptions: {
    type: Object,
    default: () => ({}),
  },
  crossOrigin: {
    type: String,
    default: 'anonymous',
  },
  requestHeader: {
    type: Object,
    default: () => ({}),
  },
  outputEncoding: {
    type: String,
    default: () => 'linear',
  },
  webGLRendererOptions: {
    type: Object,
    default: () => ({}),
  },
  mtlPath: {
    type: [String, Array],
    default: () => '',
  },
  showFps: {
    type: Boolean,
    default: false,
  },
  textureImage: {
    type: [String, Array],
    default: () => '',
  },
  clearScene: {
    type: Boolean,
    default: false,
  },
  parallelLoad: {
    type: Boolean,
    default: false,
  },
  labels: {
    type: Array,
    default: () => [],
  },
  autoPlay: {
    type: Boolean,
    default:true,
  },
  enableDraco: {
    type: Boolean,
    default: false,
  },
  dracoDir: {
    type: String,
    default: '',
  },
  intersectRecursive: {
    type: Boolean,
    default: true,
  },
  enableDamping: {
    type: Boolean,
    default: false,
  },
  dampingFactor: {
    type: Number,
    default: 0.1,
  },
  verticalCtrl: {
    type: [Boolean, Object],
    default: false,
  },
  horizontalCtrl: {
    type: [Boolean, Object],
    default: false,
  },
  plyMaterial: {
    type: String,
    default: 'MeshStandardMaterial',
  },
}


// export const modelProps
export type ModelProps = ExtractPropTypes<typeof modelProps>

export const modelPropsResolver = createPropsResolver<ModelProps>(modelProps, glSceneSchema, schemaMapper);